package cn.licoy.wdog.core.config.wx;
/**
 * @Author Sunne
 * @Date 18-8-13下午12:22
 * @Param emp-hospital
 * 高山仰止,景行行止.虽不能至,心向往之。
 * ——————————————————————————女神保佑，永无bug——————————————————————
 **/

import cn.licoy.wdog.common.util.pay.IWXPayDomain;
import cn.licoy.wdog.common.util.pay.WXPayConfig;
import cn.licoy.wdog.common.util.pay.WXPayDomainSimpleImpl;

import java.io.*;

/**
 *                    .::::.
 *                  .::::::::.
 *                 :::::::::::  FUCK YOU
 *             ..:::::::::::'
 *           '::::::::::::'
 *             .::::::::::
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ```` ':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 */


public class MyConfig extends WXPayConfig {
    private byte[] certData;

    public MyConfig() throws Exception {
        String certPath = "/templent/apiclient_cert.p12";
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    @Override
    public String getAppID() {
        return "wx9cb8c727c72467f4";
    }

    @Override
    public String getMchID() {
        return "1497030242";
    }

    @Override
    public String getKey() {
        return "123456789987654321qwertyuQWERTYU";
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public IWXPayDomain getWXPayDomain() {
        return WXPayDomainSimpleImpl.instance();
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }
}
